<!-- 数据代理: 一个对象代理了另一个对象的操作 -->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    let data = { x: 100 };
    let vm = {};
    
    Object.defineProperty(vm,'x',{
        get(){
            return data.x;
        },
        set(val){
            data.x = val;
        }
    });

</script>

</html>